<template>
    <div>
        <comp ref="bar" height="300px" width="100%" />
    </div>
</template>
<script>
import comp from "./index";
function setImpStyle(value) {
    return {
        value,
        itemStyle: {
            color: new echarts.graphic.LinearGradient(
                0,
                0,
                0,
                1,
                [
                    {
                        offset: 0,
                        color: "green",
                    },
                    {
                        offset: 1,
                        color: "red",
                    },
                ],
                false
            ),
        },
    };
}
export default {
    name: "test",
    title: "极限柱子高亮",
    components: { comp },
    theme: "black",
    data() {
        return {
            dataCols: {
                dimension: ["日期"],
                legend: {
                    data: ["类型1"],
                },
                series: [
                    {
                        日期: "1-1",
                        类型1: setImpStyle(10),
                    },
                    {
                        日期: "1-2",
                        类型1: 11,
                    },
                    {
                        日期: "1-3",
                        类型1: 12,
                    },
                    {
                        日期: "1-4",
                        类型1: 13,
                    },
                    {
                        日期: "1-5",
                        类型1: 90,
                    },
                    {
                        日期: "1-6",
                        类型1: 13,
                    },
                    {
                        日期: "1-7",
                        类型1: 90,
                    },
                    {
                        日期: "1-8",
                        类型1: setImpStyle(190),
                    },
                    {
                        日期: "1-9",
                        类型1: 90,
                    },
                ],
            },
            setting: {
                dimension: ["日期"],
                grid: {},
                legend: {},
                xAxis: {
                    axisLine: {
                        show: false,
                    },
                    axisLabel: {
                        rotate: "0",
                    },
                },
                series: {
                    barWidth: 12,
                    linear: {
                        类型1: ["#0B4EC3", "#138CEB"],
                    },
                    showBackground: true,
                    itemStyle: {},
                    barBorderRadius: [0],
                    label: {},
                },
                color: [],
            },
        };
    },
    mounted() {
        this.$nextTick(() => {
            let param = {
                dataCols: this.dataCols,
                setting: this.setting,
            };
            this.$refs.bar.initChart(param);
        });
    },
};
</script>